package com.qf.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;


/**
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.aop
 * @Description:
 * @Date 2022/9/27 21:34
 */
public class MyAroundAdvice  implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {

        try {
            System.out.println("前置");
            //执行原始方法 调用谁，执行谁
            methodInvocation.proceed();
            System.out.println("后置");

        } catch (Throwable throwable) {
            throwable.printStackTrace();
            System.out.println("异常");
        } finally {
            System.out.println("finally");
        }

        return null;
    }
}
